import matplotlib.pyplot as plt
import numpy as np
from scipy import signal


num = np.array([1, -1, 0])
den = np.array([1, -5/6, 1/6])

ws, h = signal.freqz(num, den, whole=True)

plt.rcParams['font.sans-serif'] = ['SimHei']  # 加上这一句就能在图表中显示中文
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号

plt.subplot(2, 1, 1)
plt.plot(ws, np.abs(h))
plt.title('Amplitude Spectrum')


plt.subplot(2, 1, 2)
plt.plot(ws, np.angle(h))
plt.ylabel('Phase Spectrum')
plt.xlabel(r'$\omega (rad/s)$')

plt.show()
